<template>
  <div class="page-common-layout">
    <div class="page-common-content">
      <tool-bar
          @search="$refs.table.refresh(true)"
          @reset="() => {
					(this.queryParam = {}), $refs.table.refresh(true);
				}"
      >
        <template slot="toolBtn" slot-scope="scope">
          <a-button class="cu-btn-primary" icon="plus" @click="handleAdd()">新建分类</a-button>
        </template>
        <template slot="toolForm">
          <a-form-item :label="$ct('name','名称')">
            <a-input v-model="queryParam.classificationName" :placeholder="$ct('name','名称')"/>
          </a-form-item>
          <a-form-item :label="$ct('reportCode','编码')">
            <a-input v-model="queryParam.classificationCode" :placeholder="$ct('reportCode','编码')"/>
          </a-form-item>
        </template>
      </tool-bar>
      <DataGrid ref="table" :columns="columns" :url="url" :queryParam="queryParam" rowKey="uuid" :showRowSelect="false">
         <span slot="renderCreator" slot-scope="{ text, record, index }">
          {{ text }}/{{ record.creatorId }}
        </span>
        <template slot="renderAction" slot-scope="{ text, record }">
          <a @click="() => handleEdit(record)">{{ $ct("edit", "编辑") }}</a>
          <span class="action-margin"></span>
          <a @click="() => handleSub(record)" class="action-delete">{{ $ct("delete", "删除") }}</a>
        </template>
      </DataGrid>
      <!--	新增编辑	 -->
      <edit-form ref="createModal" :visible="visible" :loading="confirmLoading" :model="mdl"
                 @cancel="handleCancel()" @ok="handleOk()"/>
    </div>
  </div>
</template>

<script>
import {
  DataGrid
} from "@/components";
import {
  dataGridMixin
} from "@/mixins/dataGridMixin";
import editForm from "./edit.vue";

export default {
  name: "Table",
  components: {
    DataGrid,
    editForm
  },
  mixins: [dataGridMixin],
  data() {
    return {
      columns: [{
        title: "名称",
        dataIndex: "classificationName",
        langCode: "name"
      },
        {
          title: "编码",
          dataIndex: "classificationCode",
          langCode: "reportCode"
        },
        {
          title: "排序",
          dataIndex: "classificationSort",
          align: "center",
          langCode: "sort",
          width: 50
        },
        {
          title: "创建人",
          dataIndex: "creator",
          scopedSlots: { customRender: "renderCreator" },
        },
        {
          title: "创建时间",
          dataIndex: "createTime",
        },
        {
          title: "操作",
          width: 100,
          dataIndex: "action",
          scopedSlots: {
            customRender: "renderAction"
          },
        },
      ],
      visible: false,
      confirmLoading: false,
      mdl: null,
      // 查询参数
      queryParam: {},
      url: {
        getPageSet: "/report/reportClassification/getPageSet",
        save: "/report/reportClassification/save",
        update: "/report/reportClassification/update",
        deleteBatch: "/report/reportClassification/deleteBatch",
      },
    };
  },
  methods: {},
};
</script>

<style scoped lang="less">

</style>
